<@override name="content">

<script type="text/javascript">
    $(document).ready(function(){
        document.onkeydown=nextpage
        document.onkeydown=nextpage
        var prevpage="status/?p=${solutionList.pageNumber-1}<#if solutionList.pageSize!=20>&s=${solutionList.pageSize}</#if>"
        var nextpage="status/?p=${solutionList.pageNumber+1}<#if solutionList.pageSize!=20>&s=${solutionList.pageSize}</#if>"
        function nextpage(event)
        {
            event=event?event:(window.event?window.event:null);
            <#if solutionList.pageNumber&gt;1>if(event.keyCode==37)location=prevpage;</#if>
            <#if solutionList.pageNumber<solutionList.totalPage>if(event.keyCode==39)location=nextpage;</#if>
        }
        });
    </script>

<div class="pagination pagination-centered">
  <div class="form-inline">
    <form class="form-search" action="status">
      <input type="number" class="input-small" name="pid" value="${pid!}" placeholder="Problem ID">
      <input type="text" class="input-small" name="name" value="${name!}" placeholder="User Name">
      <select class="input-small" id="inputResult" name="result">
        <option value="-1">Result</option> <#if judge_result??> <#list judge_result as Result>
        <option value="${Result.id!}"<#if result?? && result?eval==Result.id>selected</#if>>${Result.name!}</option> </#list> </#if>
      </select> <select class="input-medium" id="inputLanguage" name="language">
        <option value="-1">Language</option> <#if program_languages??> <#list program_languages as Language>
        <option value="${Language.id!}"<#if language?? && language==Language.id>selected</#if>>${Language.name!}</option> </#list> </#if>
      </select>
      <button type="submit" class="btn">Go</button>
    </form>
  </div>

  <div class="pull-right">
    <span class="badge badge-info">${solutionList.pageNumber}/${solutionList.totalPage} Pages</span> <span class="badge badge-info">${solutionList.totalRow}
      Records</span>
  </div>
</div>

<table id="status" class="table table-hover table-condensed">
  <thead>
    <tr>
      <th>Run ID</th>
      <th>User</th>
      <th>Problem</th>
      <th>Result</th>
      <th>Time</th>
      <th>Memory</th>
      <th>Language</th>
      <th>Code Length</th>
      <th>Submit Time</th>
    </tr>
  </thead>
  <tbody>
    <#if solutionList??> <#list solutionList.list as solution>
    <tr>
      <td class="sid">${solution.sid!}</td>
      <td class="user"><a href="user/profile/${(solution.name)!}">${(solution.name)!}</a></td>
      <td class="problem"><#if !adminUser?? && solution.alpha??> <a href="contest/problem/${solution.cid}-${solution.alpha!}">${solution.cid}-${solution.alpha!}</a>
        <#else> <a href="problem/show/${solution.pid!}">${solution.pid!}</a> <#if solution.alpha??> <a href="contest/problem/${solution.cid}-${solution.alpha!}">${solution.cid}-${solution.alpha!}</a>
        </#if> </#if>
      </td>
      <td class="result" id="${solution.resultName!}">${solution.resultLongName!}</td>
      <td class="time"><#if solution.result==0>${solution.time!0} MS</#if></td>
      <td class="memory"><#if solution.result==0>${solution.memory!0} KB</#if></td>
      <td class="language"><#if user?? &&(adminUser?? || user.uid==solution.uid)><a href="code/${solution.sid!}" target="_blank" title="show source code"></#if>
          ${solution.language!} <#if user?? &&(adminUser?? || user.uid==solution.uid)></a></#if>
      </td>
      <td class="code_len">${solution.codeLen!}B</td>
      <td class="ctime">${solution.ctime!}</td>
    </tr>
    </#list> </#if>
  </tbody>
</table>
<div class="pagination pagination-centered">
  <ul>
    <li class="<#if solutionList.pageNumber==1>disabled</#if>"><a
      href="status/?p=1<#if solutionList.pageSize!=20>&s=${solutionList.pageSize}</#if><#if query??>${query}</#if>">&lt;&lt;</a></li> <#if
    solutionList.pageNumber&gt;1>
    <li><a href="status/?p=${solutionList.pageNumber-1}<#if solutionList.pageSize!=20>&s=${solutionList.pageSize}</#if><#if query??>${query}</#if>">Prev</a></li></#if>
    <#if solutionList??> <#assign start=solutionList.pageNumber-3> <#assign end=solutionList.pageNumber+3> <#if start<1><#assign end=end-start+1><#assign
    start=1></#if> <#if end&gt;solutionList.totalPage ><#assign start=start-(end-solutionList.totalPage)-1><#if start<1><#assign start=1></#if><#assign
    end=solutionList.totalPage></#if> <#if end
    <start><#assign end=start></#if> <#list start..end as x>
    <li class="<#if x==solutionList.pageNumber>active</#if>"><a
      href="status/?p=${x}<#if solutionList.pageSize!=20>&s=${solutionList.pageSize}</#if><#if query??>${query}</#if>">${x}</a></li>
    </#list> </#if> <#if solutionList.pageNumber<solutionList.totalPage>
    <li><a href="status/?p=${solutionList.pageNumber+1}<#if solutionList.pageSize!=20>&s=${solutionList.pageSize}</#if><#if query??>${query}</#if>">Next</a></li>
    </#if>
    <li class="<#if solutionList.pageNumber&gt;=solutionList.totalPage>disabled</#if>"><a
      href="status/?p=${solutionList.totalPage}<#if solutionList.pageSize!=20>&s=${solutionList.pageSize}</#if><#if query??>${query}</#if>">&gt;&gt;</a></li>
  </ul>
</div>
<script type="text/javascript" src="assets/js/placeholders.min.js"></script>
</@override>
<@override name="scripts">
</@override>
<@extends name="../common/_layout.html" />
